﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Windows.Controls.Ribbon;
using System.Globalization;

namespace MHP3rd
{
	/// <summary>
	/// MainWindow.xaml 的互動邏輯
	/// </summary>
	public partial class MainWindow : RibbonWindow
	{
		private string ls_sex;

		public MainWindow()
		{
			InitializeComponent();
			this.Operate_Start.IsEnabled = true;
			initialItem();
		}

		private void initialItem()
		{
			setComboxItem(ref RoleType_sex, "Sex");
			setComboxItem(ref RoleType_weapon, "Weapon");
			setTab0Group0();
			setTab0Group1();
			setTab0Group2();
			setTab0Group3();
			setTab0Group4();
		}


		private void setComboxItem(ref RibbonComboBox target, string as_key)
		{
			int li_counter = 0;

			while (true)
			{
				RibbonComboBoxItem lrcb_item = new RibbonComboBoxItem();
				try
				{
					lrcb_item.Content = FindResource(as_key + li_counter.ToString()).ToString();
					lrcb_item.DataContext = FindResource(as_key + "Id" + li_counter.ToString()).ToString();
					target.Items.Add(lrcb_item);
					li_counter += 1;
				}
				catch
				{
					break;
				}
			}
		}

		private void setTab0Group0()
		{
			RoleType.Command = new RibbonCommand() { LabelTitle = FindResource("Tab0Group0").ToString() };
		}

		private void setTab0Group1()
		{
			Weapon.Command = new RibbonCommand() { LabelTitle = FindResource("Tab0Group1").ToString() };

			Weapon_weapon.Command = new RibbonCommand() { LabelTitle = FindResource("SysWeapon").ToString() };
			Weapon_head.Command = new RibbonCommand() { LabelTitle = FindResource("SysHead").ToString() };
			Weapon_body.Command = new RibbonCommand() { LabelTitle = FindResource("SysBody").ToString() };
			Weapon_hand.Command = new RibbonCommand() { LabelTitle = FindResource("SysHand").ToString() };
			Weapon_waist.Command = new RibbonCommand() { LabelTitle = FindResource("SysWaist").ToString() };
			Weapon_foot.Command = new RibbonCommand() { LabelTitle = FindResource("SysFoot").ToString() };
			//Weapon_stone.Command = new RibbonCommand() { LabelTitle = FindResource("SysStone").ToString() };

		}

		private void setTab0Group2()
		{
			Skill.Command = new RibbonCommand() { LabelTitle = FindResource("Tab0Group2").ToString() };

			Skill1.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill01").ToString() };
			Skill2.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill02").ToString() };
			Skill3.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill03").ToString() };
			Skill4.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill04").ToString() };
			Skill5.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill05").ToString() };
			Skill6.Command = new RibbonCommand() { LabelTitle = FindResource("SysSkill06").ToString() };
		}

		private void setTab0Group3()
		{
			Other.Command = new RibbonCommand() { LabelTitle = FindResource("Tab0Group3").ToString() };

			Other_Point.Command = new RibbonCommand() { LabelTitle = FindResource("SysDefence").ToString() };
			Other_hole.Command = new RibbonCommand() { LabelTitle = FindResource("SysHole").ToString() };
			Other_diff.Command = new RibbonCommand() { LabelTitle = FindResource("SysPointFix").ToString() };
			Other_rank.Command = new RibbonCommand() { LabelTitle = FindResource("SysRank").ToString() };
		}

		private void setTab0Group4()
		{
			Operate.Command = new RibbonCommand() { LabelTitle = FindResource("Tab0Group4").ToString() };

			RibbonCommand Command = new RibbonCommand() { LabelTitle = FindResource("SysStartExcute").ToString()};
			Command.CanExecute += ( sender, e ) => e.CanExecute = true;

			Operate_Start.Command = Command;
		}

		private void TabSelectedFilterTab(object sender, RoutedEventArgs e)
		{
			Grid1.Visibility = System.Windows.Visibility.Visible;
			//Grid2.Visibility = System.Windows.Visibility.Hidden;
		}
		private void TabSelectedOtherTab(object sender, RoutedEventArgs e)
		{
			Grid1.Visibility = System.Windows.Visibility.Hidden;
			//Grid2.Visibility = System.Windows.Visibility.Visible;
		}
		private void Operate_Start_Click(object sender, RoutedEventArgs e)
		{
			MessageBox.Show("");
		}

		private void RibbonCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = true;
		}

		private void Image_MouseUp(object sender, MouseButtonEventArgs e)
		{
			System.Diagnostics.Process.Start("http://www.capcom.co.jp/monsterhunter/P3rd/enter.html");
		}

		private void Weapon_w_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Window win = new WeaponWindow();
			win.ShowDialog();
		}
	}


}
